#include <iostream>

class Test
{
public:
    Test()
    {
        c++;
    }
    ~Test()
    {
        c--;
    }
    static int c;
};
/* 静态成员变量的初始化必须在类外 */
int Test::c = 0;

int main()
{
    // Test t;
    // t.c = 20;

    // Test a;
    // std::cout << a.c << std::endl;
    // std::cout << Test::c << std::endl;

    Test * t1 = new Test();
    Test * t2 = new Test();
    delete t1, t2;
    delete t2;

    std::cout << Test::c << std::endl;
    return 0;
}